const { defineConfig } = require("@vue/cli-service");
("use strict");
const path = require("path");
const port = 1314; // 端口

const timeStamp = new Date().getTime();
function resolve (dir) {
    return path.join(__dirname, dir);
}

const name = "智桂通申请办理"; // 标题

module.exports = defineConfig({
    transpileDependencies: true,
    lintOnSave: false,
    devServer: {
        // https:true,
        host: "0.0.0.0",
        port: port,
        // proxy: {
        //   // 设置代理
        //   "/zgt": {
        //     // 代理名称   凡是使用/api开头的地址都是用此代理
        //     target: "http://192.168.0.23:8099", // 需要代理访问的api地址
        //     changeOrigin: true, // 允许跨域请求
        //     // pathRewrite: {
        //     //   // 重写路径，替换请求地址中的指定路径
        //     //   '^/api': '/' // 将请求地址中的/api替换为空，也就是请求地址中不会包含/api/
        //     // }
        //   },
        // },
    },
    assetsDir: "static",
    publicPath: "./",
    css: {
        extract: {
            filename: `static/css/[name].${timeStamp}.css`,
            chunkFilename: `static/css/[name].${timeStamp}.css`
        }
    },
    configureWebpack: {
        name: name,
        resolve: {
            alias: {
                "@": resolve("src"),
            },
        },
        output: {
            filename: `static/js/[name].${timeStamp}.js`,
            chunkFilename: `static/js/[name].${timeStamp}.js`,
        },
        module: {
            rules: [
                {
                    test: /\.mjs$/,
                    include: /node_modules/,
                    type: "javascript/auto",
                },
            ],
        },
    },
});
